﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace GosWeb.Models.Db
{
    [ComplexType]
    public class Location:ICloneable
    {
        //[ForeignKey()]
        //[Key]
        //public string BiontID { get; set; }

        [Display(Name = "场")]
        [StringLength(20)]
        public string Site { get; set; }

        [Display(Name = "栋号")]
        public int? Building { get; set; }

        [Display(Name = "栏号")]
        public int? Room { get; set; }

        [Display(Name = "备注")]
        [StringLength(20)]
        public string Desc { get; set; }

        public override string ToString()
        {
            string s = Site;
            if (Building > 0)
            {
                s += ' ' + Building + "栋";
            }
            if (Room > 0)
            {
                s +=' ' + Room + "栏"; ;
            }

            return s;
        }

        public object Clone()
        {
            Location lo = new Location();
            lo.Building = this.Building;
            lo.Room = this.Room;
            lo.Site = this.Site;
            return lo;     
        }
    }

}